﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WuDada.Core.Post.Domain;
using WuDada.Core.Post.Persistence;
using NHibernate;

namespace WuDada.Core.Post.Service.Impl
{
    public class TagService : ITagService
    {
        public ITagDao TagDao { get; set; }

        /// <summary>
        /// 新增Tag
        /// </summary>
        /// <param name="tagVO">被新增的Tag</param>
        /// <returns>新增後的Tag</returns>
        public TagVO CreateTag(TagVO tagVO)
        {
            tagVO = TagDao.CreateTag(tagVO);
            return tagVO;
        }

        /// <summary>
        /// 取得Tag By TagId
        /// </summary>
        /// <param name="tagId">TagId</param>
        /// <returns>Tag</returns>
        public TagVO GetTagById(int tagId)
        {
            return TagDao.GetTagById(tagId);
        }        

        /// <summary>
        /// 刪除Tag
        /// </summary>
        /// <param name="tagVO">被刪除的Tag</param>
        public void DeleteTag(TagVO tagVO)
        {
            TagDao.DeleteTag(tagVO);
        }

        /// <summary>
        /// 更新Tag
        /// </summary>
        /// <param name="tagVO">被更新的Tag</param>
        /// <returns>更新後的Tag</returns>
        public TagVO UpdateTag(TagVO tagVO)
        {
            return TagDao.UpdateTag(tagVO);
        }

        /// <summary>
        /// 取得Tag清單
        /// </summary>
        /// <param name="conditions">搜尋條件</param>
        /// <returns>Tag清單</returns>
        public IList<TagVO> GetTagList(IDictionary<string, string> conditions)
        {
            return TagDao.GetTagList(conditions);
        }

        /// <summary>
        /// 取得Tag數量
        /// </summary>
        /// <param name="conditions"></param>
        /// <returns></returns>
        public int GetTagCount(IDictionary<string, string> conditions)
        {
            return TagDao.GetTagCount(conditions);
        }
    }
}
